Show AllShow All

About using Microsoft Query to retrieve external data

What is Microsoft Query?

Microsoft Query is a program for bringing data from external sources into other Microsoft Office programs— in particular, Microsoft Excel. By using Query to retrieve data from your corporate databases and files, you don't have to retype the data you want to analyze in Excel. You can also update your Excel reports and summaries automatically from the original source database whenever the database is updated with new information.

Types of databases you can access    You can retrieve data from several types of databases, including Microsoft Access, Microsoft SQL Server, and Microsoft SQL Server OLAP Services. You can also retrieve data from Excel lists and from text files.

In Excel, you can also retrieve data from Web pages, but you don't need Query to do this. For information about retrieving data from Web pages, see Excel Help.

Selecting data from a database    You retrieve data from a database by creating a query, which is a question you ask about data stored in an external database. For example, if your data is stored in an Access database, you might want to know the sales figures for a specific product by region. You can retrieve a part of the data by selecting only the data for the product and region you want to analyze and omitting the data you don't need.

Example of selecting data in Query

Callout 1 Columns selected in Query Wizard

Callout 2 Selected columns brought into Excel

Updating your worksheet in one operation    After you have external data in an Excel workbook, whenever your database changes, you can refresh the data to update your analysis— without having to recreate your summary reports and charts. For example, you can create a monthly sales summary and refresh it every month when the new sales figures come in.

Using Query to retrieve data    Bringing external data into Excel with Query takes three steps: First you set up a data source to connect to your database, then you use the Query Wizard to select the data you want, and finally you return the data to Excel where you can format it, summarize it, and create reports from it.

ShowSetting up data sources

ShowDefining your query

ShowWorking with the data in Microsoft Excel